from __future__ import unicode_literals

from django.db import models
from django.contrib.auth.models import User

# Create your models here.


class UserProfile(models.Model):
    user = models.OneToOneField(User)
    name = models.CharField(max_length=32)
    # group = models.ManyToManyField('UserGroup')
    friends = models.ManyToManyField('self', related_name='my_friends')

    def __unicode__(self):
        return self.name

class QQGroup(models.Model):
    name = models.CharField(max_length=64, unique=True)
    members = models.ManyToManyField(UserProfile, blank=True)
    admins = models.ManyToManyField(UserProfile, related_name='group_admins')
    description = models.CharField(max_length=255, default="nothing...")
    max_member_nums = models.IntegerField(default=200)

    class Meta:
        verbose_name = 'groups'
        verbose_name_plural = 'groups'
    def __unicode__(self):
        return self.name